<template>
    <div class="wechatPayment-page">
        <el-breadcrumb separator=">">
            <el-breadcrumb-item>财务中心</el-breadcrumb-item>
            <el-breadcrumb-item :to="{ path: '/cost' }">费用中心</el-breadcrumb-item>
            <el-breadcrumb-item :to="{ path: '/card-renew' }">支付宝白名单</el-breadcrumb-item>
        </el-breadcrumb>
        <div class="wechatPayment-content">
            <div class="title">支付宝白名单</div>
            <!-- 说明 -->
            <div class="desc">
                <div>
                    <p>提示: 自取柜支付宝未全量开通，如果需要开通支付宝支付, 请自行添加, 开通前请您知晓 </p>
                    <p>1、因为支付宝是单次授权, 所以每次开门前都需要消费者授权 </p>
                    <p>2、因为支付宝是单次授权, 支付宝订单的补扣, 无法系统发起退款，只能消费者去小程序主动支付</p>
                </div>
            </div>
            <!-- 表格 -->
            <div class="content tables">
                <div class="search">
                    <el-button round color="#0071bb" :icon="Plus" @click="onApplyRecord()">新建</el-button>
                    <div>
                        <el-button round color="#0071bb" :icon="Search">搜索</el-button>
                        <el-button round :icon="Refresh" style="margin-right:10px">刷新</el-button>
                        <el-dropdown :hide-on-click="false">
                            <span class="el-dropdown-link">
                                <el-button round color="#0071bb" :icon="HelpFilled">筛选</el-button>
                            </span>
                            <template #dropdown>
                                <el-dropdown-menu style="max-height: 300px">
                                    <el-dropdown-item v-for="(item, index) in checkArr" :key="index"
                                        @click.stop="filterTableData(item)">
                                        <el-checkbox v-model="item.show" size="large" :label="item.label" />
                                    </el-dropdown-item>
                                </el-dropdown-menu>
                            </template>
                        </el-dropdown>
                    </div>
                </div>
                <el-table :data="tableData" style="width: 100%">
                    <el-table-column type="selection" v-model="whole" width="50px" />
                    <el-table-column :prop="item.prop" :label="item.label" :width="item.width"
                        v-for="(item, index) in headerArr" :key="index">

                    </el-table-column>
                    <el-table-column prop="" label="操作">
                        <template #default="scope">
                            <el-button color="red" size="small" @click="onDelete(scope.$index, scope.row)"
                                style="color:#fff">删除</el-button>
                        </template>
                    </el-table-column>
                    <!-- <el-table-column prop="time" label="设备名称" />
                    <el-table-column prop="no" label="设备编号" />
                    <el-table-column prop="content" label="生产编号" />
                    <el-table-column prop="" label="操作">
                        <template #default="scope">
                            <el-button color="red" size="small" @click="onDelete(scope.$index, scope.row)"
                                style="color:#fff">删除</el-button>
                        </template>
                    </el-table-column> -->
                </el-table>
            </div>
            <!-- 底部分页 -->
            <div class="page_number">
                <el-pagination v-model:current-page="currentPage" v-model:page-size="pageSize" :size="size"
                    :disabled="disabled" layout="prev, pager, next, jumper,total" :total="10"
                    @size-change="handleSizeChange" @current-change="handleCurrentChange" />
            </div>
        </div>
        <!-- 新建 -->
        <ApplyRecord v-if="showApplyRecord" @close="onCloseRecord()" @submit="onCloseRecord()"></ApplyRecord>
    </div>
</template>
  
<script setup lang="ts">
import { ref } from "vue";
import { Refresh, Search, RefreshLeft, Plus } from "@element-plus/icons-vue";
import ApplyRecord from './components/applyRecord.vue'
const whole = ref(null);
const currentPage = ref(1);
const pageSize = ref(1);
const size = ref();
const show = ref<boolean>(false);
const activeCard = ref("1");
const cardList = ref([
    {
        name: "全部",
        index: "1",
    },
    {
        name: "乐汇园",
        index: "2",
    },
    {
        name: "非乐汇园",
        index: "3",
    },
]);
// 表格数据
const tableData = ref<any[]>([
    {
        id: "1",
        deviceName: "新颜路1号",
        deviceNo: "869825043628429",
        proNo: "209000356825",
    },
    {
        id: "1",
        deviceName: "新颜路1号",
        deviceNo: "869825043628429",
        proNo: "209000356825",
    },
    {
        id: "1",
        deviceName: "新颜路1号",
        deviceNo: "869825043628429",
        proNo: "209000356825",
    },
]);
// 列表选中的属性
const checkArr = ref<any>([
    { label: "设备名称", prop: "deviceName", show: true },
    { label: "设备编号", prop: "deviceNo", show: true },
    { label: "生产编号", prop: "proNo", show: true,},
]);
const headerArr = ref<any>([
    { label: "设备名称", prop: "deviceName", show: true },
    { label: "设备编号", prop: "deviceNo", show: true },
    { label: "生产编号", prop: "proNo", show: true,},
]);
const filterTableData = (item: any) => {
    setTimeout(() => {
        headerArr.value = checkArr.value.filter((item: any) => item.show == true);
    }, 500);
};
const handleSizeChange = (val: number) => {
    console.log(`${val} items per page`);
};
const handleCurrentChange = (val: number) => {
    console.log(`current page: ${val}`);
};
const onDelete = (row: any) => {

}
// 申请记录
const showApplyRecord = ref(false)
const onApplyRecord = () => {
    showApplyRecord.value = true
}
const onCloseRecord = () => {
    showApplyRecord.value = false
}
</script>
  
<style scoped lang="scss">
.el-form-item {
    margin: 0px;
    display: flex;
    align-items: center;
    margin-right: 20px !important;

    label {
        height: 100%;
        display: inline-block;
    }
}

.wechatPayment-page {
    padding: 20px 10px;
    box-sizing: border-box;
    background-color: #f1f1f1;
}

.wechatPayment-content {
    padding: 10px;
    background: #fff;
    margin-top: 20px;
    border-radius: 4px;
}

.title {
    color: #4d4d4d;
    font-weight: 500;
    font-size: 16px;
    margin-bottom: 10px;
}

// 说明
.desc {
    padding: 10px 20px;
    margin-top: 10px;
    background: #00ffff;

    .text {
        color: #000000;
        // font-size: 18px;
        margin-bottom: 6px;
    }

    .formula {
        color: #666666;
        font-size: 12px;
    }
}

.search {
    width: 100%;
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    margin: 10px 0;

}

.line-btn {
    margin: 15px 0px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.apply {
    position: absolute;
    right: 30px;
}

.f0a93e {
    color: #ffffff;
}

.card {
    display: flex;
    align-items: center;
    justify-content: start;
    font-size: 12px;

    .date-tabs {
        text-align: center;
        display: flex;
        font-size: 12px;
        padding: 10px;

        .tabs-item {
            width: 60px;
            padding: 5px;
            background-color: #fff;
            border: 1px solid #d2d2d2;
            border-radius: 20px;
            margin-right: 5px;
        }

        .activity-item {
            background-color: #0071bb;
            border: 1px solid #0071bb;
            color: #fff;
        }

        .tabs-item:hover {
            cursor: pointer;
        }
    }
}


:deep() {
    .el-form-item__label {
        font-size: 12px !important;
    }

    .el-form-item__content {
        width: 140px !important;
    }
}

.df {
    display: flex;
    align-items: center;
}

.fd {
    font-weight: bold;
}

.list {
    padding: 0 30px;

    box-sizing: border-box;

    .item {
        height: 40px;
        line-height: 40px;
        color: #4d4d4d;
        font-size: 16px;
        position: relative;

        .name {
            width: 180px;
            display: inline-block;
            text-align: right;
        }

        .value {
            margin-left: 10px;
        }

        .tip {
            color: #989898;
            font-size: 12px;
        }
    }
}

.dialog-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0 20px;
    font-size: 14px;
}
</style>
  